Skip to content

Conversation

@jiwon-oai
Copy link
Collaborator

Add Attachment.upload_descriptor which specifies the upload method (post vs. put) and any custom headers to pass along.

Breaking:

  • Removed Attachment.upload_url
  • When handling AttachmentsCreateReq for phase 1 of a 2-phase upload, ChatKitServer calls await self.store.save_attachment(attachment, context=context) after calling attachment_store's create method. Previously it was the responsibility of attachment_store to save the attachment to the data store, which forced the attachment store to have access to / depend on the thread data store.

attachment = await attachment_store.create_attachment(
request.params, context
)
await self.store.save_attachment(attachment, context=context)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing in this breaking cleanup since the upload descriptor change is already breaking.

This makes it so that ChatKitServer is in charge of saving the attachment metadata to the data store, just as it is responsible for self.store.delete_attachment below. No longer forces the attachment store to have access to data store just to save the attachment metadata.

id: str
name: str
mime_type: str
upload_url: AnyUrl | None = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing for a clean break. The client will continue to support this field from older versions.

chatkit/types.py Outdated
"""Two-phase upload instructions."""

url: AnyUrl
method: Literal["put", "post"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all caps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg - updated!

@jiwon-oai jiwon-oai added this pull request to the merge queue Jan 5, 2026
Merged via the queue into main with commit db76588 Jan 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants